<?php
namespace Home\Controller;
use Think\Controller;
class MasterController extends Controller {


	public function masterlist(){
		//获取所有大师信息
		//$master_id=$_GET['master_id'];
		$masterModel=M('master');
		$master=$masterModel->table('master m,master_course mc,master_type mt')->where('m.master_id=mc.master_id and m.master_type_id=mt.master_type_id')->select();
		$this->master=$master;
		$this->ajaxReturn($master,'JSON');
		echo json_encode($master);

	}
	public function getMasterDetail(){
		//获取大师详情页面
		$masterDetailModel=M('master');
		$master_id=$_GET['master_id'];
		$masterDetail=$masterDetailModel->order('m.master_id asc')->table('master m,master_course mc,master_type mt')->where("m.master_id='$master_id' and m.master_id=mc.master_id and m.master_type_id=mt.master_type_id")->field('m.master_id,m.master_name,mc.*,mt.*')->select();
		$this->masterDetail=$masterDetail;
		$this->ajaxReturn($masterDetail,'JSON');
		//echo json_encode($masterDetail);
	}
	// public function masterLike(){
 //    $master_number=$_GET['master_number'];
 //    $user_password=$_GET['user_password'];
 //    $userModel=M('users');
 //    $user=$userModel->where("username='$username' and user_password='$user_password'" )->field('user_id')->select();
 //    if($user==null)
 //    {
 //         echo  json_encode(failed);
 //    }
 //    else
 //    {
 //        $_SESSION['user_id']=$map['user_id'];
 //        $_SESSION['username']=$map["username"];
 //        echo  json_encode(successful);
 //    }
 //    echo json_encode($user);
 //  }

}
?>